subroutine find_xsec(e,r)
  use param
  use global
  implicit none
  real(dbl),intent(in) :: e
  real(dbl),intent(out) :: r
  integer :: i
  r=0
  if (e.le.xsec%mine) return
  do i=xsec%pos,1,-1
     if (e.lt.xsec%e(i)) then
        xsec%pos=i
        exit
     end if
  end do
  r=xsec%x(i)+(xsec%x(i)-xsec%x(i-1)) &
       *(e-xsec%e(i-1))/(xsec%e(i)-xsec%e(i-1))
  return
end subroutine find_xsec
